package com.cc.moxingvoice.ui.main;

import android.databinding.DataBindingUtil;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cc.moxingvoice.R;
import com.cc.moxingvoice.base.BaseFragment;
import com.cc.moxingvoice.databinding.FragmentVoicePackageBinding;
import com.cc.moxingvoice.lock.AppBarLock;
import com.cc.moxingvoice.lock.VoicePackageLock;

/**
 * 创建日期：2018/3/17 on 14:57
 * 描述：
 * 作者：郭士超
 * QQ：1169380200
 */

public class VoicePackageFragment extends BaseFragment {

    private FragmentVoicePackageBinding mBinding;
    private VoicePackageLock mLock;
    private AppBarLock appBarLock;

    @Override
    protected View initBinding(LayoutInflater inflater, ViewGroup container) {
        mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_voice_package, container, false);
        mLock = new VoicePackageLock(getContext(), mBinding, mBundle);
        mBinding.setLock(mLock);
        appBarLock = new AppBarLock(getContext(),  mLock, getString(R.string.moxing),
                0, 0, "", getString(R.string.manage), AppBarLock.NULL, AppBarLock.VOICE_PACKAGE_RIGHT);
        mBinding.appBar.setAppBarLock(appBarLock);
        return mBinding.getRoot();
    }

    @Override
    protected void init() {

    }

    public void refreshList() {
        if (mLock == null){
            return;
        }
        mLock.refreshList();
    }

    @Override
    public void onResume() {
        appBarLock.barData.setTitleRight(getString(R.string.manage));
        appBarLock.barData.notifyChange();
        mLock.refreshList();
        super.onResume();
    }

}
